/*************************************************************
 * * Copyright (c) 2008-2010  Hillstonenet
 *
 * All Rights Reserved
 * 
 * This is the proprietary source code of Hillstonenet Company product HSM
 *
 * @author yan peng
 *
 * 2010-12-16 11:55:38
 * 
 ***************************************************************/
package com.hillstone.hsm.common.object.user;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class User implements Serializable {

	private static final long serialVersionUID = 8566325957501265283L;
	private int userId;
	// private int level;// 1:administrators role's user; 2:general user
	private int authenServerId;
	private int authoriServerId;
	private String userName;
	private String password;
	private String alias;
	private int status; // 1:valid; 2:invalid
	private String mobilePhone;
	private String phoneNumber;
	private String email;
	private String companyName;
	private String department;
	private Date createTime;
	private Date lastLoginTime;

	private int timeOut;// unit: minute
	private String remark;
	private int operation = 3;// 2:only-read 3:write
	private boolean online;
	private String sessionId;// maybe will use to cotrol client, and currently,
								// it is not used. only used for single client
								// use
								// private String authId;// to be used for the
								// changing of user authorization.
								// // be generated by backend, can for the user
								// on each
								// // client to login
	private String token;
	
	
	/**
	 * 1: 本地登录  2：AAA登录
	 */
	private int loginType = 1;	
	public User() {

	}
	
	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}


	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public int getTimeOut() {
		return timeOut;
	}

	public void setTimeOut(int timeOut) {
		this.timeOut = timeOut;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public int getOperation() {
		return operation;
	}

	public void setOperation(int operation) {
		this.operation = operation;
	}

	public boolean isOnline() {
		return online;
	}

	public void setOnline(boolean online) {
		this.online = online;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}


	public int getLoginType() {
		return loginType;
	}

	public void setLoginType(int loginType) {
		this.loginType = loginType;
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", userName=" + userName
				+ ", password=******" + ", alias=" + alias + ", status="
				+ status + ", mobilePhone=" + mobilePhone + ", phoneNumber="
				+ phoneNumber + ", email=" + email + ", companyName="
				+ companyName + ", department=" + department + ", createTime="
				+ createTime + ", lastLoginTime=" + lastLoginTime
				+ ", timeOut=" + timeOut + ", remark=" + remark
				+ ", operation=" + operation + ", online=" + online
//				+ ", sessionId=" + sessionId + ",
				+ "]";
	
		
	}
	
	/* 
	 * 请勿随意修改hashCode方法
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + userId;
		return result;
	}

	/* 
	 * 请勿随意修改hashCode方法
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (userId != other.userId)
			return false;
		return true;
	}
	

	public void setAuthenServerId(int authenServerId) {
		this.authenServerId = authenServerId;
	}

	public int getAuthenServerId() {
		return authenServerId;
	}

	public void setAuthoriServerId(int authoriServerId) {
		this.authoriServerId = authoriServerId;
	}

	public int getAuthoriServerId() {
		return authoriServerId;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}
}